<template>
  <div class="app-container">
    <!-- <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
       <el-form-item label="店铺名称" prop="title">
         <el-input
           v-model="queryParams.title"
           placeholder="请输入公司名称"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>


       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>-->

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          @click="queryPointByDeptId()"
        >加载全部店铺</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          size="mini"
          @click="queryPointByDeptId(0)"
        >加载待分配店铺</el-button>
      </el-col>

      <!--<el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['app:appcostcompany:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['app:appcostcompany:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['app:appcostcompany:remove']"
        >删除</el-button>
      </el-col>
   &lt;!&ndash;   <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['app:appcostcompany:export']"
        >导出</el-button>
      </el-col>-->
    </el-row>

    <el-row :gutter="20">
      <!--部门数据-->
      <el-col :span="6" :xs="24">
        <el-table
          :data="userList"
          stripe
          style="width: 100%">
          <el-table-column
            type="index"
          >
          </el-table-column>
          <el-table-column
            prop="nickName"
            label="姓名"
            >
          </el-table-column>
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="210">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                v-if="scope.row.state == '1'"
                @click="startPolygon(scope.$index, scope.row)"
                icon="el-icon-edit"
              >设置标签</el-button>
              <el-button
                size="mini"
                type="text"
                v-if="scope.row.state == '2'"
                @click="endPolygon(scope.$index, scope.row)"
                icon="el-icon-edit"
              >完成设置</el-button>
             <el-button
                 size="mini"
                 type="text"
                 icon="el-icon-delete"
                 @click="queryPointByDeptId(scope.row.userId)"
               >查看所属店铺</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <!--用户数据-->
      <el-col :span="18" :xs="24">
        <div class="amap-wrapper">
          <div class="amap-page-container">
            <el-amap-search-box class="search-box" :search-option="searchOption" :on-search-result="onSearchResult"></el-amap-search-box>
            <el-amap vid="amapDemo" :center="mapCenter" :zoom="zoom" :events="events" class="amap-demo">
              <el-amap-marker v-for="(marker, index) in markers" :position="marker.position"  :vid="index" :title="marker.title" :offset="marker.offset" :icon="marker.icon"></el-amap-marker>
              <el-amap-polygon v-for="(polygon, index) in polygons" :vid="index" :ref="`polygon_${index}`" :path="polygon.path" :draggable="polygon.draggable" :events="polygon.events" ></el-amap-polygon>
            </el-amap>
          </div>
        </div>
      </el-col>
    </el-row>



    <!-- 添加或修改店铺管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-tabs type="border-card">
          <el-tab-pane label="基础信息">
            <el-form-item label="店铺名称" prop="title">
              <el-input v-model="form.title" placeholder="请输入公司名称" />
            </el-form-item>
            <el-form-item label="门头照" prop="companyPic">
              <!--<el-input v-model="form.companyPic" placeholder="请输入门头照" />-->
              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="(response, file, fileList) => handleSuccess(response, file, fileList, '1')"
                :http-request="uploadCompnayPic">
                <img v-if="form.companyPic" :src="'../prod-api/app/files/' + form.companyPic" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-form-item>
            <el-form-item label="选择位置" prop="lat">

            </el-form-item>

            <el-form-item label="" >
              <el-input  placeholder="请输入纬度" :value="'当前经纬度:' + currLatLng"/>
            </el-form-item>

            <!--<el-form-item label="是否隐藏 " prop="hide">
              <el-input v-model="form.hide" placeholder="请输入是否隐藏 " />
            </el-form-item>-->
          </el-tab-pane>

          <el-tab-pane label="营业执照">
            <el-form-item label="营业执照" prop="licensePic">
              <!--<el-input v-model="form.licensePic" placeholder="请输入营业执照" />-->
              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="(response, file, fileList) => handleSuccess(response, file, fileList, '2')"
                :http-request="uploadLicense">
                <img v-if="form.licensePic" :src="'../prod-api/app/files/' + form.licensePic" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <el-dialog :visible.sync="form.licensePic == ''">
                <img width="100%" :src="form.licensePic" alt="">
              </el-dialog>
            </el-form-item>
            <el-form-item label="公司名称" prop="companyName">
              <el-input v-model="form.companyName" placeholder="请输入公司名称" />
            </el-form-item>
            <el-form-item label="公司法人" prop="name">
              <el-input v-model="form.name" placeholder="请输入公司法人" />
            </el-form-item>
            <el-form-item label="联系方式" prop="mobile">
              <el-input v-model="form.mobile" placeholder="请输入联系方式" />
            </el-form-item>
            <el-form-item label="公司地址" prop="address">
              <el-input v-model="form.address" placeholder="请输入公司地址" />
            </el-form-item>
            <el-form-item label="经营范围" prop="businessScope">
              <el-input
                type="textarea"
                :autosize="{ minRows: 4, maxRows: 4}"
                placeholder="请输入经营范围"
                v-model="form.businessScope">
              </el-input>
            </el-form-item>
            <el-form-item label="执照编号" prop="businessCode">
              <el-input v-model="form.businessCode" placeholder="请输入执照编号" />
            </el-form-item>
          </el-tab-pane>

          <el-tab-pane label="缴费信息">
            <el-form-item label="缴费类型">
              <el-radio-group v-model="form.costType">
                <el-radio key="0" label="0">是</el-radio>
                <el-radio key="1" label="1">否</el-radio>
              </el-radio-group>

            </el-form-item>
            <el-form-item label="公司类型" v-if="form.costType == '0'">
              <el-radio-group v-model="form.costCompnayType" @change="changeHandlerType">
                <el-radio
                  v-for="item in allprojectList"
                  :key="item.id"
                  :label="item.id"
                >{{item.name}}</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="收费分类" v-if="form.costType == '0'">
              <el-select v-model="form.projectId" placeholder="请选择收费分类" @change="changeHandlerProject">
                <el-option
                  v-for="project in costProjectList"
                  :key="project.id"
                  :label="project.name"
                  :value="project.id"
                />
              </el-select>
              <div v-for="project in categoryRateList">区间(元):{{project.minNum}}-{{project.maxNum}}  &nbsp;&nbsp;单价:{{project.money}}元/{{project.unit}}</div>
            </el-form-item>
            <el-form-item label="收费标准" prop="costStandard" v-if="form.costType == '0'">
              <el-input v-model="form.costStandard" placeholder="请输入收费标准" />
            </el-form-item>
            <el-form-item label="应收金额" prop="totalMoney" v-if="form.costType == '0'">
              <el-input v-model="form.totalMoney" placeholder="请输入应收金额" />
            </el-form-item>
            <el-form-item label="目前已缴费金额" prop="money" v-if="form.costType == '0'">
              <el-input v-model="form.money" placeholder="请输入目前已缴费金额" />
            </el-form-item>
          </el-tab-pane>

          <el-tab-pane label="清运信息">
            <el-form-item label="清运单位" prop="clearUnit">
              <el-radio-group v-model="form.clearUnit">
                <el-radio
                  v-for="dict in clearUnitOptions"
                  :key="dict.dictValue"
                  :label="dict.dictValue"
                >{{dict.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="垃圾生产量" prop="clearNum">
              <el-input v-model="form.clearNum" placeholder="请输入垃圾生产量" />
            </el-form-item>
            <el-form-item label="联系人姓名" prop="clearName">
              <el-input v-model="form.clearName" placeholder="请输入联系人姓名" />
            </el-form-item>
            <el-form-item label="联系人方式" prop="clearMobile">
              <el-input v-model="form.clearMobile" placeholder="请输入联系人姓名" />
            </el-form-item>
            <el-form-item label="清运公司名称" prop="clearCompanyName">
              <el-input v-model="form.clearCompanyName" placeholder="请输入清运公司名称" />
            </el-form-item>
          </el-tab-pane>
        </el-tabs>
        <!--<el-form-item label="收费项目编号" prop="cid">
          <el-input v-model="form.cid" placeholder="请输入收费项目编号" />
        </el-form-item>
        <el-form-item label="收费项目名称" prop="cname">
          <el-input v-model="form.cname" placeholder="请输入收费项目名称" />
        </el-form-item>
        <el-form-item label="收费单价" prop="cmoney">
          <el-input v-model="form.cmoney" placeholder="请输入收费单价" />
        </el-form-item>
        <el-form-item label="收费单位" prop="cunit">
          <el-input v-model="form.cunit" placeholder="请输入收费单位" />
        </el-form-item>
        <el-form-item label="最小单位" prop="cmin">
          <el-input v-model="form.cmin" placeholder="请输入最小单位" />
        </el-form-item>
        <el-form-item label="最大单位" prop="cmax">
          <el-input v-model="form.cmax" placeholder="请输入最大单位" />
        </el-form-item>
        <el-form-item label="收费项目ID" prop="projectId">
          <el-input v-model="form.projectId" placeholder="请输入收费项目ID" />
        </el-form-item>
        <el-form-item label="收费项目" prop="projectName">
          <el-input v-model="form.projectName" placeholder="请输入收费项目" />
        </el-form-item>-->

        <!--<el-form-item label="删除标记" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除标记" />
        </el-form-item>
        <el-form-item label="状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态" />
        </el-form-item>
        <el-form-item label="归属部门编号" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入归属部门编号" />
        </el-form-item>
        <el-form-item label="归属部门" prop="deptName">
          <el-input v-model="form.deptName" placeholder="请输入归属部门" />
        </el-form-item>-->




      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import { queryPointList ,queryUserList, getAppcostcompany, delAppcostcompany, addAppcostcompany, updateAppcostcompany , uploadCompnayPic,uploadLicense ,updateCompanyLable} from "@/api/app/appcostcompany";

  export default {
    name: "Appcostcompany",
    data() {
      let self = this;
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 总条数
        total: 0,
        // 店铺管理表格数据
        appcostcompanyList: [],
        userList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          state: undefined,
          deptId: undefined,
        },
        // 表单参数
        form: {},
        clearUnitOptions:[],
        allprojectList:[],
        costProjectList:[],
        categoryRateList:[],
        // 表单校验
        rules: {
          title: [
            { required: true, message: "公司名称不能为空", trigger: "blur" }
          ],
          companyPic: [
            { required: true, message: "门头照不能为空", trigger: "blur" }
          ],
          createTime: [
            { required: true, message: "创建时间不能为空", trigger: "blur" }
          ]
        },
        currLatLng: '',
        // 高德地图
        events: {
          init(o) {
            console.log("初始化高德地图1")
          },
          click(e) {

            self.form.lng = e.lnglat.lng;
            self.form.lat = e.lnglat.lat;
            self.currLatLng = e.lnglat.lng + ","+e.lnglat.lat;
            console.log(self.currLatLng);
            //self.addMarker(e.lnglat.lng, e.lnglat.lat);
            self.addPolygonLatLng(e.lnglat.lng, e.lnglat.lat);

          }
        },
        markers: [

        ],
        searchOption: {
          city: '邯郸',
          citylimit: true
        },
        zoom: 20,
        mapCenter: [114.494707,36.61089],
        polygons: [

        ],
        start:true
      };
    },
    created() {
      this.queryPointList();
      this.queryUserList();
      // this.queryCostProjectList();
      // this.getDicts("app_clear_unit").then(response => {
      //   this.clearUnitOptions = response.data;
      // });
    },
    methods: {
      queryPointByDeptId(deptId) {
        let that = this;
        this.markers = [];
        that.queryParams.deptId = deptId;
        console.log("**********queryPointByDeptId*********");
        console.log(that.queryParams.deptId);
        that.queryPointList();
      },
      /** 查询店铺管理列表 */
      /** 查询店铺管理列表 */
      queryPointList() {
        let that = this;
        this.loading = true;
        queryPointList(that.queryParams).then(response => {
          //this.appcostcompanyList = response.data;
          this.loading = false;
          setTimeout(function () {
            response.data.forEach(function (item, index, array) {

              if(index == 0){
                that.mapCenter = [item.x, item.y];
              }
              var color = "";
              if(item.state == "3"){
                color = "http://yishoutong.hbweiyinqing.cn/prod-api/app/files/blue3.png";
              }else if(item.state == "2"){
                color = "http://yishoutong.hbweiyinqing.cn/prod-api/app/files/blue2.png";
              }else{
                color = "http://yishoutong.hbweiyinqing.cn/prod-api/app/files/blue1.png";
              }
              that.addMarker(item.id, item.title, item.x, item.y, color, that.index);
              that.index++;
              console.log(item.title);
              console.log(that.index);
            });
          }, 100);

        });
      },
      queryUserList() {
        let that = this;
        this.loading = true;
        queryUserList().then(response => {
          that.loading = false;
          that.userList = response.data;
          setTimeout(function () {
            response.data.forEach(function (item, index, array) {
              console.log(item);
              that.addPolygon(item);
            });
          }, 300);
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          id: undefined,
          cid: undefined,
          cname: undefined,
          cmoney: undefined,
          cunit: undefined,
          cmin: undefined,
          cmax: undefined,
          projectId: undefined,
          projectName: undefined,
          title: undefined,
          companyPic: undefined,
          lat: '',
          lng: '',
          licensePic: undefined,
          compnayName: '',
          name: '',
          mobile: undefined,
          address: undefined,
          businessScope: undefined,
          businessCode: undefined,
          costType: undefined,
          costCompnayType: undefined,
          costStandard: undefined,
          totalMoney: undefined,
          money: undefined,
          clearUnit: undefined,
          clearNum: undefined,
          clearName: undefined,
          clearMobile: undefined,
          clearCompanyName: undefined,
          hide: undefined,
          delFlag: undefined,
          remark: undefined,
          state: undefined,
          deptId: undefined,
          deptName: undefined,
          createBy: undefined,
          createTime: undefined
        };
        this.currLatLng = "";
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length!=1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加店铺管理";
      },
      /** 提交按钮 */
      submitForm: function() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.id != undefined) {
              updateCompanyLable(this.form).then(response => {
                if (response.code === 200) {
                  this.msgSuccess("修改成功");
                  this.open = false;
                  this.getList();
                }
              });
            } else {
              addAppcostcompany(this.form).then(response => {
                if (response.code === 200) {
                  this.msgSuccess("新增成功");
                  this.open = false;
                  this.getList();
                }
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const ids = row.id || this.ids;
        this.$confirm('是否确认删除店铺管理编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delAppcostcompany(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('app/appcostcompany/export', {
          ...this.queryParams
        }, `app_appcostcompany.xlsx`)
      },
      // 高德地图搜索功能
      addMarker: function(id, title, lng, lat, icon, index) {
        var that = this;
        var marker = {};
        marker.icon = icon;
        marker.offset = [-20, -28];
        marker.position = [lng, lat];

        var events = {};
        events.click = function(){//添加方法
          if(id){
            that.handleUpdate(id,index);

          }else{
            that.handleAdd();
          }

        }
        marker.events = events;

        if(title){
          marker.title = title;
        }

        that.markers.push(marker);
        // this.markers = [];
        // this.markers.push([lng, lat]);
        // console.log("addMarker");
      },
      addPolygon: function(row) {
        console.log(JSON.stringify(row));
        var that = this;
        var polygon = {};
        polygon.draggable = true;
        polygon.path = [];



        var events = {};
        events.click = function(){//添加方法
          alert(1);
        }
        polygon.events = events;
        that.polygons.push(polygon);
      },
      startPolygon: function(index, row) {

        let that = this;
        console.log("开始：" + that.start);
        if(that.start){
          that.start = false;
          row.state = "2";
          that.form = row;
          that.form.index = index;
        }else{
          this.$alert('绘制识别，当前正在绘制中', '系统提示');
        }
      },
      endPolygon: function(index, row) {
        let that = this;
        console.log("结束：" + that.start);
        if(!that.start){
          that.start = true;
          row.state = "1";
          console.log(JSON.stringify(row));
          let userId = row.userId;
          let enclosure = JSON.stringify(this.polygons[that.form.index].path)
          console.log(enclosure);
          console.log(JSON.stringify(row));
          let pts = [];
          this.polygons[that.form.index].path.forEach(function (item, index, array) {
            let point = {};
            if(index == 0){
              point.x = item.lng;
              point.y = item.lat;
            }else{
              point.x = item[0];
              point.y = item[1];
            }
            pts.push(point);
            //console.log(item);
            //that.addPolygon(item);
          });
          //that.form.pts = "[{\"x\":114.491919,\"y\":36.627433},{\"x\":114.492059,\"y\":36.627527},{\"x\":114.492059,\"y\":36.627153},{\"x\":114.494167,\"y\":36.627136},{\"x\":114.494349,\"y\":36.62742}]";

          this.form.deptId = this.form.userId;
          this.form.deptName = this.form.nickName;
          this.form.remark = JSON.stringify(pts);
          updateCompanyLable(this.form).then(response => {
            if (response.code === 200) {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }
          });
          // let enclosure = JSON.stringify(this.polygons[that.form.index].path)
          // console.log(enclosure);
          this.polygons[that.form.index].path = [];
          let color = "";
          that.reset();
        }else{
          this.$alert('绘制失败，当前正在绘制中', '系统提示');
        }

      },
      addPolygonLatLng: function(lng, lat) {
        var that = this
        if(!that.start){
          this.polygons[that.form.index].path.push([lng, lat]);
          console.log(this.polygons[that.form.index].path);
          console.log("************addPolygonLatLng****************");
        }


      },
      onSearchResult(pois) {
        if (pois.length > 0) {
          let {lng, lat} = pois[0];
          //this.markers.push([lng, lat]);
          this.mapCenter = [lng, lat];
          // pois.forEach(poi => {
          //   let {lng, lat} = poi;
          // });


        }
      },
      uploadCompnayPic(param) {
        var fileObj = param.file;
        // FormData 对象
        var formData = new FormData();
        // 文件对象
        formData.append("picfile", fileObj);
        uploadCompnayPic(formData)
          .then(response => {
            if (response.code === 200) {
              //this.msgSuccess("附件上传成功");
              //this.form.testifyFile = response.url;
              //上传成功 调用onSuccess方法，否则没有完成图标
              //处理自己的逻辑
              param.onSuccess(response);
              fileObj.url = response.url;
            } else {
              this.msgError(response.msg);
            }
          })
          .catch(err => {
            console.log(err);
          });
      },
      uploadLicense(param) {
        var fileObj = param.file;
        // FormData 对象
        var formData = new FormData();
        // 文件对象
        formData.append("picfile", fileObj);
        uploadLicense(formData)
          .then(response => {
            if (response.code === 200) {
              //this.msgSuccess("附件上传成功");
              //this.form.testifyFile = response.url;
              //上传成功 调用onSuccess方法，否则没有完成图标
              //处理自己的逻辑
              param.onSuccess(response);
              fileObj.url = response.url;
            } else {
              this.msgError(response.msg);
            }
          })
          .catch(err => {
            console.log(err);
          });
      },
      handlePreview(file) {
        this.form.uploadCompnayPic = file.url;
        console.log("---------------handlePreview--------------");
      },
      handleRemove(file, fileList) {
        console.log("---------------handleRemove--------------");
        // var that = this;
        // that.form.testifyFile = JSON.stringify(fileList);
        // console.log(that.form.testifyFile);
      },
      handleSuccess(response, file, fileList, type) {
        console.log(response);

        if(response.code && response.code == 200){
          if(type == "1"){
            this.form.companyPic = response.data;
          }else if(type == "2"){
            this.form.licensePic = response.data;
          }

        }
      },
      handlePictureCardPreview(file) {
        this.form.licensePic = file.url;
      },
      changeHandlerType(value) {
        console.log('改变之后的值是:' + value)
        var that = this;
        this.allprojectList.forEach(function (item, index, array) {
          if(item.id == value){
            console.info(JSON.stringify(item)); //当前元素的值
            that.costProjectList = item.children;
            console.log(that.costProjectList);
            console.log("-------------changeHandlerType-------------");
          }
        });
      },
      changeHandlerProject(value) {
        console.log('改变之后的值是:' + value)
        var that = this;
        this.costProjectList.forEach(function (item, index, array) {
          if(item.id == value){
            console.info(JSON.stringify(item)); //当前元素的值
            that.categoryRateList = item.children;
            console.log(that.categoryRateList);
            console.log("------------changeHandlerProject--------------");
          }
        });
      }
    }
  };
</script>

<style scoped>
  .amap-wrapper {
    width: 100%;
    height:calc(100vh - 130px);
  }
  .amap-demo {
    margin-top: -40px;
    height:calc(100vh - 130px);
  }

  .search-box {
    position: absolute;
    top: 25px;
    left: 20px;
  }

  .amap-page-container {
    position: relative;
    width: 100%;
    height:calc(100vh - 140px);
  }

  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
